﻿using FrameDesign.FrameWork;
using FrameDesign.FrameWork.Rule;
using UnityEngine;
using NotImplementedException = System.NotImplementedException;

namespace FrameDesign.Example2.Scripts.System
{
    public interface IAchievementSystem : ISystem
    {

    }
    public class AchievementSystem : AbstractSystem, IAchievementSystem
    {

        public IArchitecture Architecture { get; set; }

        protected override void OnInit() // 修改
        {
            var counterModel = this.GetModel<ICounterModel>(); // 修改

            var previousCount = counterModel.Count.Value;

            counterModel.Count.RegisterOnValueChanged((newCount =>
            {
                if (newCount >= 10 && previousCount < 10)
                {
                    Debug.Log("解锁 10 次点击成就");
                }
                else if (newCount >= 20 && previousCount < 20)
                {
                    Debug.Log("解锁 20 次点击成就");
                }

                previousCount = newCount;
            }));
        }
    }
}